﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[RequireComponent(typeof(Text))]
public class UISliderValueText : MonoBehaviour
{
    public Slider slider;
    private Text text;

    private void Start()
    {
        this.text = base.GetComponent<Text>();
        if (this.slider != null)
        {
            this.text.text = this.slider.value + string.Empty;
            this.slider.onValueChanged.AddListener((UnityAction<float>) (v => (this.text.text = v + string.Empty)));
        }
    }
}

